<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/doctrine/BaseFormFilterDoctrine.class.php');

/**
 * UsuarioReferencia filter form base class.
 *
 * @package    filters
 * @subpackage UsuarioReferencia *
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 11675 2008-09-19 15:21:38Z fabien $
 */
class BaseUsuarioReferenciaFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'no_banco'               => new sfWidgetFormFilterInput(),
      'nu_agencia'             => new sfWidgetFormFilterInput(),
      'nu_telefone_banco'      => new sfWidgetFormFilterInput(),
      'no_comercial'           => new sfWidgetFormFilterInput(),
      'nu_telefone_comercial'  => new sfWidgetFormFilterInput(),
      'no_fornecedor'          => new sfWidgetFormFilterInput(),
      'nu_telefone_fornecedor' => new sfWidgetFormFilterInput(),
      'no_amigo'               => new sfWidgetFormFilterInput(),
      'nu_telefone_amigo'      => new sfWidgetFormFilterInput(),
      'id_dados_usuario'       => new sfWidgetFormDoctrineChoice(array('model' => 'DadosUsuario', 'add_empty' => true)),
      'created_at'             => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'updated_at'             => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
    ));

    $this->setValidators(array(
      'no_banco'               => new sfValidatorPass(array('required' => false)),
      'nu_agencia'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'nu_telefone_banco'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'no_comercial'           => new sfValidatorPass(array('required' => false)),
      'nu_telefone_comercial'  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'no_fornecedor'          => new sfValidatorPass(array('required' => false)),
      'nu_telefone_fornecedor' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'no_amigo'               => new sfValidatorPass(array('required' => false)),
      'nu_telefone_amigo'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'id_dados_usuario'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'DadosUsuario', 'column' => 'id_dados_usuario')),
      'created_at'             => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'updated_at'             => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
    ));

    $this->widgetSchema->setNameFormat('usuario_referencia_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'UsuarioReferencia';
  }

  public function getFields()
  {
    return array(
      'id_usuario_refeencia'   => 'Number',
      'no_banco'               => 'Text',
      'nu_agencia'             => 'Number',
      'nu_telefone_banco'      => 'Number',
      'no_comercial'           => 'Text',
      'nu_telefone_comercial'  => 'Number',
      'no_fornecedor'          => 'Text',
      'nu_telefone_fornecedor' => 'Number',
      'no_amigo'               => 'Text',
      'nu_telefone_amigo'      => 'Number',
      'id_dados_usuario'       => 'ForeignKey',
      'created_at'             => 'Date',
      'updated_at'             => 'Date',
    );
  }
}